| Conditions | 6 |
| Paths | 10 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | export const getRowBoundingRect = (row, container = null) => { |
||
| 2 | |||
| 3 | if (!container) { |
||
| 4 | container = row && row.offsetParent |
||
| 5 | ? row.offsetParent.offsetParent |
||
| 6 | : null; |
||
| 7 | } |
||
| 8 | |||
| 9 | if (!container) { |
||
| 10 | return {}; |
||
| 11 | } |
||
| 12 | |||
| 13 | const rowBCR = row.getBoundingClientRect(); |
||
| 14 | const containerBCR = container.getBoundingClientRect(); |
||
| 15 | |||
| 16 | const spaceBottom = containerBCR.bottom - rowBCR.bottom; |
||
| 17 | const spaceTop = rowBCR.top - containerBCR.top; |
||
| 18 | |||
| 19 | const maxHeight = Math.max(spaceBottom, spaceTop); |
||
| 20 | const position = spaceTop > spaceBottom |
||
| 21 | ? 'top' |
||
| 22 | : 'bottom'; |
||
| 23 | |||
| 24 | return { |
||
| 25 | maxHeight, |
||
| 26 | position, |
||
| 27 | spaceTop, |
||
| 28 | spaceBottom |
||
| 29 | }; |
||
| 30 | }; |
||
| 31 |